package com.sniff.atp.modules.test.service.impl;

import com.sniff.atp.modules.test.mapper.BaseDataMapper;
import com.sniff.atp.modules.test.mapper.CustomerGuideMapper;
import com.sniff.atp.modules.test.mapper.beework.ProjectMapper;
import com.sniff.atp.modules.test.model.BaseData;
import com.sniff.atp.modules.test.model.CustomerGuideDTO;
import com.sniff.atp.modules.test.model.beework.Project;
import com.sniff.atp.provider.DataSource;
import com.sniff.atp.provider.DataSourceType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @BelongsProject: boot-vue-parent
 * @BelongsPackage: com.bootvue.service
 * @Author: zxy
 * @CreateTime: 2024-01-25 20:55
 * @Description: 链接不同数据库
 * @Version: 1.0
 */
@Service
public class CustomerGuideService {
    @Autowired
    private CustomerGuideMapper customerGuideMapper;

    @Autowired
    private BaseDataMapper BaseDataMapper;

    @Autowired
    private ProjectMapper projectMapper;

    @DataSource(DataSourceType.SLAVE)
    public List<CustomerGuideDTO> getAll(Long customerGuideId) {
        List<CustomerGuideDTO> list = customerGuideMapper.getAll(customerGuideId);
        return list;
    }

    @DataSource(DataSourceType.MASTER)
    public List<BaseData> getAllList() {
        List<BaseData> list = BaseDataMapper.selectList(null);
        return list;
    }

    @DataSource(DataSourceType.BEEWORK)
    public List<Project> getAllList1() {
        List<Project> list = projectMapper.selectList(null);
        return list;
    }




}
